<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <script src="/sb/js/jquery-1.8.3.js"></script>
</head>
<body>
<center>
  <h1>部门添加</h1>
  <table>
    <tbody>
    <tr>
      <td>部门名字</td><td><input  id="dname" type="text"></td>
    </tr>
    <tr>
      <td>部门位置</td><td><input id="loc" type="text"></td>
    </tr>
    <tr>
      <td colspan="2" align="center"><input onclick="insertNews()" type="button" value="添加"></td>
    </tr>
    </tbody>
  </table>
</center>
<script>
    //添加按钮
    function insertNews() {
        var dname = $("#dname").val();
        var loc = $("#loc").val();
        $.get(
            "/sb/dept/insertDept",
            {dname:dname,loc:loc},
            function(data) {
                alert(data.msg);
                location.href="list.html";
            },
            "json"
        );
    }
</script>
</body>
</html>
